package tool.lib.volley;

import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.NoConnectionError;
import com.android.volley.ParseError;
import com.android.volley.Response.ErrorListener;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;

import tool.lib.ToastTool;


public class ExErrorListener implements ErrorListener{

	@Override
	public void onErrorResponse(VolleyError error) {
		// TODO Auto-generated method stub
		if(error instanceof NoConnectionError || error instanceof NetworkError )
            ToastTool.getInstance().showToast("网络无连接,请联网后操作");
		else if(error instanceof TimeoutError)
            ToastTool.getInstance().showToast("网速较慢,请稍后操作");
		else if(error instanceof ServerError || error instanceof AuthFailureError)
            ToastTool.getInstance().showToast("服务器异常");
        else if(error instanceof ParseError)
            ToastTool.getInstance().showToast("出错了!请重试");
		else
            ToastTool.getInstance().showToast("未知错误");
			
		
	}

	
	
}
